<?php

require_once('Classes/NConfigFileCreator.php');

class Download
{
    private $fileContent;
    private $fileName;
    private $fileSize;

    public function setFile()
    {
        $this->fileContent = NConfigFileCreator::getFile();
        $this->fileSize = strlen($this->fileContent);
        $this->fileName = "nconfig.php";
    }

    public function returnDownload()
    {
        header("Content-type: application/force-download");
        header("Content-Transfer-Encoding: Binary");
        header("Content-length: ".$this->fileSize);
        header("Content-disposition: attachment; filename=\"".$this->fileName."\"");
        echo $this->fileContent;
    }
}

$d = new Download();
$d->setFile();
$d->returnDownload();

?>